import 'dart:convert';

HospitalListEntity hospitalListEntityFromJson(String str) =>
    HospitalListEntity.fromJson(json.decode(str));

String hospitalListEntityToJson(HospitalListEntity data) =>
    json.encode(data.toJson());

class HospitalListEntity {
  HospitalListEntity({
    this.code,
    this.data,
    this.message,
  });

  int code;
  List<Datum> data;
  String message;

  factory HospitalListEntity.fromJson(Map<String, dynamic> json) =>
      HospitalListEntity(
        code: json["code"],
        data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
        message: json["message"],
      );

  Map<String, dynamic> toJson() => {
        "code": code,
        "data": List<dynamic>.from(data.map((x) => x.toJson())),
        "message": message,
      };
}

class Datum {
  Datum({
    this.masterTel,
    this.distance,
    this.city,
    this.cityCode,
    this.validDate,
    this.latitude,
    this.regDate,
    this.contactMan,
    this.contactTel,
    this.photoUrl,
    this.practiceName,
    this.province,
    this.natureId,
    this.longitude,
    this.profession,
    this.area,
    this.hospitalGrade,
    this.address,
    this.orgName,
    this.servicePhone,
    this.provinceCode,
    this.natureName,
    this.keyId,
    this.ownHospitalName,
    this.orgId,
    this.hospitalMaster,
    this.adminName,
    this.photoFileId,
    this.ownHospitalCode,
    this.areaCode,
    this.adminPhone,
    this.hospitalLevel,
    this.practiceCode,
  });

  String masterTel;
  double distance;
  String city;
  String cityCode;
  DateTime validDate;
  String latitude;
  DateTime regDate;
  String contactMan;
  String contactTel;
  String photoUrl;
  String practiceName;
  String province;
  int natureId;
  String longitude;
  String profession;
  String area;
  String hospitalGrade;
  String address;
  String orgName;
  String servicePhone;
  String provinceCode;
  String natureName;
  String keyId;
  String ownHospitalName;
  String orgId;
  String hospitalMaster;
  String adminName;
  String photoFileId;
  int ownHospitalCode;
  String areaCode;
  String adminPhone;
  String hospitalLevel;
  int practiceCode;

  factory Datum.fromJson(Map<String, dynamic> json) => Datum(
        masterTel: json["masterTel"],
        distance: json["distance"],
        city: json["city"],
        cityCode: json["cityCode"],
        validDate: DateTime.parse(json["validDate"]),
        latitude: json["latitude"],
        regDate: DateTime.parse(json["regDate"]),
        contactMan: json["contactMan"],
        contactTel: json["contactTel"],
        photoUrl: json["photoUrl"],
        practiceName: json["practiceName"],
        province: json["province"],
        natureId: json["natureID"],
        longitude: json["longitude"],
        profession: json["profession"],
        area: json["area"],
        hospitalGrade: json["hospitalGrade"],
        address: json["address"],
        orgName: json["orgName"],
        servicePhone: json["servicePhone"],
        provinceCode: json["provinceCode"],
        natureName: json["natureName"],
        keyId: json["keyID"],
        ownHospitalName: json["ownHospitalName"],
        orgId: json["orgID"],
        hospitalMaster: json["hospitalMaster"],
        adminName: json["adminName"],
        photoFileId: json["photoFileID"],
        ownHospitalCode: json["ownHospitalCode"],
        areaCode: json["areaCode"],
        adminPhone: json["adminPhone"],
        hospitalLevel: json["hospitalLevel"],
        practiceCode: json["practiceCode"],
      );

  Map<String, dynamic> toJson() => {
        "masterTel": masterTel,
        "distance": distance,
        "city": city,
        "cityCode": cityCode,
        "validDate":
            "${validDate.year.toString().padLeft(4, '0')}-${validDate.month.toString().padLeft(2, '0')}-${validDate.day.toString().padLeft(2, '0')}",
        "latitude": latitude,
        "regDate":
            "${regDate.year.toString().padLeft(4, '0')}-${regDate.month.toString().padLeft(2, '0')}-${regDate.day.toString().padLeft(2, '0')}",
        "contactMan": contactMan,
        "contactTel": contactTel,
        "photoUrl": photoUrl,
        "practiceName": practiceName,
        "province": province,
        "natureID": natureId,
        "longitude": longitude,
        "profession": profession,
        "area": area,
        "hospitalGrade": hospitalGrade,
        "address": address,
        "orgName": orgName,
        "servicePhone": servicePhone,
        "provinceCode": provinceCode,
        "natureName": natureName,
        "keyID": keyId,
        "ownHospitalName": ownHospitalName,
        "orgID": orgId,
        "hospitalMaster": hospitalMaster,
        "adminName": adminName,
        "photoFileID": photoFileId,
        "ownHospitalCode": ownHospitalCode,
        "areaCode": areaCode,
        "adminPhone": adminPhone,
        "hospitalLevel": hospitalLevel,
        "practiceCode": practiceCode,
      };
}
